#pragma once

#include "fuse_structs.h"

#include "precomp.h"
#include "mrxglobs.h"

#include <ntdef.h>
#include <time.h>

typedef enum _FUSE_CACHE_RESULT {
    SUCCESS,
    FAIL,
    NO_KEY,
    EXPIRED_KEY,
    INVALID_HANDLE,
    SECOND_INITIALIZATION,
    ALLOCATION_ERROR
} FUSE_CACHE_RESULT;

FUSE_CACHE_RESULT
FuseCacheInit(
    IN OUT PPFUSE_CACHE   ppCache,
    IN FUSE_CONTEXT       context,
    IN size_t             maxElements,
    IN unsigned long long ttlNs
);

void
FuseCacheRelease(PFUSE_CACHE Cache);

FUSE_CACHE_RESULT
FuseCacheAdd(PFUSE_CACHE, PCHAR Key, UINT64 item);

FUSE_CACHE_RESULT
FuseCacheGet(PFUSE_CACHE, PCHAR Key, PUINT64 item);

FUSE_CACHE_RESULT
FuseCacheRemove(PFUSE_CACHE, PCHAR Key);

FUSE_CACHE_RESULT
FuseCacheClear(PFUSE_CACHE);

FUSE_CACHE_RESULT
FuseCacheRemoveAllWithPrefix(PFUSE_CACHE cache, PCHAR pathPrefix);